function Can_Base()
{
	Object_Util.apply(this, arguments);
	this.datas = new Array();
	this.init();
}
extend_usemid(Can_Base, Object_Util);

/**
 * 
 */
Can_Base.prototype.init = function()
{
}

/**
 * 执行任何方法的先决条件判断 datas是否为空等
 */
Can_Base.prototype.isValid_Datas = function()
{
	var _result = true;
	if (this.datas === undefined || this.datas === null)
	{
		_result = false;
	}
	return _result;
}

/**
 * 找出对象
 */
Can_Base.prototype.findData = function(aattr, avalue)
{
	var _result = null;
	if (this.isValid_Datas())
	{
		for ( var i = 0; i < this.datas.length; i++)
		{
			if (this.datas[i][aattr] == avalue)
			{
				_result = this.datas[i];
			}
		}
	}
	return _result;
}

/**
 *  更新对象
 */
Can_Base.prototype.updateData = function(aattr, avalue, aobj)
{
	var _result = null;
	if (this.isValid_Datas())
	{
		for ( var i = 0; i < this.datas.length; i++)
		{
			if (this.datas[i][aattr] == avalue)
			{
				this.datas[i] = aobj;
				_result = i;
			}
		}
	}
	return _result;
}


/**
 * 添加元素
 */
Can_Base.prototype.add = function(data)
{
	if (this.isValid_Datas())
	{
		var _isArray = data instanceof Array;
		if (_isArray)
		{
			for ( var i in data)
			{
				this.datas.push(data[i]);
			}
		}
		else
		{
			this.datas.push(data);
		}
	}
}

/**
 * 移除元素
 */
Can_Base.prototype.popByField = function(field, value)
{
	if (this.isValid_Datas())
	{
		for(var i in this.datas)
		{
			if(this.datas[i][field] === value)
			{
				this.datas[i] = null;
			}
		}
	}
}

// ////////////////////

function Can_Array()
{
	Can_Base.apply(this, arguments);
}
extend_usemid(Can_Array, Can_Base);

// //////////////////////

/**
 * 为fact对象服务
 */
function Can_Fact()
{
	Can_Array.apply(this, arguments);
}
extend_usemid(Can_Fact, Can_Array);

/**
 * 为所有对象服务
 * @returns
 */
function Can_Object()
{
	Can_Array.apply(this, arguments);
}
extend_usemid(Can_Object, Can_Array);

